/**
 * Created by Administrator on 14-1-7.
 */
(function($) {
    var arkflow = $.arkflow;

    // 创建编辑框
    arkflow.editors.TextEditor = Base.extend({
        constructor : function() {
        },
        init : function(props, k, div, src, r) {
            this._props = props;
            this._k = k;
            this._div = div;
            this._src = src;
            this._r = r;
            var me = this;
            $('<input  style="width:100%;"/>').val(this._src.text()).change(function() {
                me._path[me._k].value = $(this).val();
                $(me._r).trigger("textchange", [$(this).val(), me._src]);
            }).appendTo("#" + this._div);
            $("#" + this._div).data("editor", this);
        },
        destroy : function() {
            var me = this;
            $("#" + this._div + " input").each(function() {
                me._props[me._k].value = $(this).val();
                $(me._r).trigger("textchange", [$(this).val(), me._src]);
            });
        }
    });

})(jQuery);
